<?php require_once($_SERVER['DOCUMENT_ROOT']."/defaultconf.mex");
	MYTCONN();
	$rsStr = '';
	$GET= $GLOBALS['MYT']->db_array("SELECT cta_ID AS COLID,
					cta_Conta AS COL1,
					cta_AUID AS COL2,
					cta_Fecha AS COL3,
					cta_FechaValor AS COL4,
					cta_Albaran AS COL5,
					cta_Usuario AS COL6,
					cta_Concepto AS COL7,
					cta_Valor AS COL8,
					cta_SaldoAnt AS COL9,
					cta_SaldoAct AS COL10
  			FROM dtlcuentasag
			WHERE cta_Conta = {$_POST['acoAccount']} AND cta_FechaValor BETWEEN '{$_POST['aco_DateStart']} 00:00:00' AND '{$_POST['aco_DateEnd']} 23:59:59'");
	$CARD = $GET[0];
	for ($i=1;$i<=$CARD;$i++) {
		$rsStr .= "[{$GET[$i]['COLID']},'{$GET[$i]['COL1']}','{$GET[$i]['COL2']}','{$GET[$i]['COL3']}','{$GET[$i]['COL4']}','{$GET[$i]['COL5']}','{$GET[$i]['COL8']}','{$GET[$i]['COL9']}','{$GET[$i]['COL10']}'],";
	}?>
<script charset="utf-8" type="text/javascript">
disableSelection(document.getElementById("rsAco"));

Ext.onReady(function(){

    var myData = [<?=substr($rsStr,0,strlen($rsStr)-1);?>];

    var ds = new Ext.data.Store({
        reader: new Ext.data.ArrayReader({}, [
			   {name: 'O_ID', type: 'int'},
               {name: 'COL1', type: 'string'},
               {name: 'COL2', type: 'string'},
               {name: 'COL3', type: 'string'},
			   {name: 'COL4', type: 'string'},
               {name: 'COL5', type: 'string'},
			   {name: 'COL8', type: 'string'},
			   {name: 'COL9', type: 'string'},
			   {name: 'COL10', type: 'string'}
          ])
    });
    ds.loadData(myData);
    var colModel = new Ext.grid.ColumnModel([
		{header: "Numero", width: 40, sortable: true, locked:true, dataIndex: 'O_ID'},
		{header: "Dominio", width: 160, sortable: true, locked:true, dataIndex: 'COL1'},
		{header: "Data Mov", width: 116, sortable: true, locked:true, dataIndex: 'COL2'},
        {header: "Data Valor", width: 116, sortable: true, locked:true, dataIndex: 'COL3'},
        {header: "Movimento", width: 80, sortable: true, dataIndex: 'COL4'},
        {header: "Por", width: 200, sortable: true, locked:true,dataIndex: 'COL5'},
        {header: "Valor", width: 80, sortable: true, locked:true, align:'right', dataIndex: 'COL8'},
        {header: "Saldo Anterior", width: 80, sortable: true, align:'right', dataIndex: 'COL9'},
        {header: "Saldo", width: 80, sortable: true, align:'right', dataIndex: 'COL10'}
    ]);

   var selmode = new Ext.grid.RowSelectionModel({});
   var Console = new Ext.grid.GridPanel({
		ds: ds,
		cm: colModel,
		sm: selmode,
		height: 300,
        renderTo: 'rsAco'
    });

});
</script>